#%RAML 1.0
title: Users
version: v1
baseUri: http://github.com/org/folio/mod-users

documentation:
  - title: mod-users API
    content: This documents the API calls that can be made to query and manage users of the system

types:
  userdata: !include ../../schemas/tagged-record-example/userdata.json
  userdataCollection: !include ../../schemas/tagged-record-example/userdataCollection.json
  errors: !include ../../schemas/errors.schema

traits:
  orderable: !include ../../traits/orderable.raml
  pageable: !include ../../traits/pageable.raml
  searchable: !include ../../traits/searchable.raml
  language: !include ../../traits/language.raml
  validate: !include ../../traits/validation.raml
  facets: !include ../../traits/facets.raml

resourceTypes:
  collection: !include ../../rtypes/collection.raml
  collection-item: !include ../../rtypes/item-collection.raml
  get-only: !include ../../rtypes/get-only.raml
  post-empty-body: !include ../../rtypes/post-empty-body.raml

/users:
  type:
    collection:
      exampleCollection: !include ../../examples/tagged-record-example/user_collection.sample
      exampleItem: !include ../../examples/tagged-record-example/user.sample
      schemaCollection: userdataCollection
      schemaItem: userdata
  get:
    is: [
      searchable: {description: "", example: "active=true sortBy username"},
      orderable: {fieldsList: "field A, field B"},
      pageable,
      facets
    ]
    description: Return a list of users
  post:
    is: [validate]
    description: Create a user
  /{userId}:
    type:
      collection-item:
        exampleItem: !include ../../examples/mod-users/user.sample
        schema: userdata
    get:
      description: Get a single user
